/* ------------------------------------------------------------------- Problem set #5 Main program ------------------------------------------------------------------- */ #include "network.hh" main(int argc, char* argv[]) { // Accept data file as parameter on command line, complain if not there: if (argc != 2) { cerr << "Usage: " << argv[0] << " \n"; exit(0); } // Declare matrices input_data and output_data as zero-dimensional // The routine read_data below will resize them to the proper size matrix input_data(0, 0), output_data(0, 0); // Read data from file into matrices input_data and output_data read_data(argv[1], input_data, output_data); // Set up useful variables int input_dimensions = input_data.columns(); int output_dimensions = output_data.columns(); int training_examples = input_data.rows(); // Call this to initialize our model so it can set up weights initialize(input_dimensions, output_dimensions); // Randomize the weights of our model from -scale to +scale // scale = 1 in the call below: randomize_weights(1); // An example of how to read a parameter from the 'parameters' file. // You can read doubles and ints from the parameter file // read_parameter is called with the parameter name as it appears in // the parameter file, the variable to set, and a default value in // case the parameter doesn't appear in the file double learning_rate; read_parameter("mu", learning_rate, .1); // A useful method of both vector and matrix is zero(), which zeros // out all elements. Call it with something like v.zero(); // Now you must write the gradient descent code, using the gradient // descent algorithm of your choice. You will use the functions // you wrote in one_layer.cc and two_layer.cc. // Your code here }